package com.qk.management.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author 16778
 * @date 2025/10/17 11:21
 * @description
 */
@Slf4j
@Aspect
@Component
public class TimeCountAspect {

    @Pointcut(value = "execution(* com.qk.management.service.*.*(..))")
    public void pt(){

    }

    @Around("pt()")
    public Object timeCount(ProceedingJoinPoint joinPoint) throws Throwable {
        long start = System.currentTimeMillis();

        Object proceed = joinPoint.proceed();

        long end = System.currentTimeMillis();

        String methodName = joinPoint.getSignature().getName();
        String className = joinPoint.getTarget().getClass().getName();
        log.info("=========================={}:{}",className,methodName);
        return proceed;
    }
}
